%%%-------------------------------------------------------------------
%%% @author kk
%%% @copyright (C) 2024, <COMPANY>
%%% @doc
%%% 查找在元组或列表中某个位置的元素
%%% @end
%%% Created : 19. 7月 2024 12:11
%%%-------------------------------------------------------------------
-module(d7).
-author("kk").

%% API
-export([getElement/1, getElement/2]).

getElement([]) -> null.
getElement(List, Index) -> getElement(List, Index, 1).
getElement([H | List], Index, I) ->
  if
    I == Index -> H;
    true -> getElement(List, Index, I + 1)
  end.